package com.dlust.myplayer

import androidx.compose.runtime.mutableStateOf

/**
 * 媒体播放器的全局配置
 */
object MediaConfig {
    // 视频类型枚举
    enum class VideoType(val displayName: String) {
        DASH("DASH视频"),
        HLS("HLS视频"),
        MP4("MP4视频")
    }

    // DASH格式视频
    const val DASH_VIDEO_URL = "https://dash.akamaized.net/dash264/TestCases/1c/qualcomm/1/MultiRate.mpd"
    
    // HLS格式视频
    const val HLS_VIDEO_URL = "https://1304796331.vod-qcloud.com/fe5f3696vodtranssh1304796331/7a60c9331397757907901951428/adp.10.m3u8"
    // 备用HLS格式: "https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8"
    
    // MP4格式视频
    const val MP4_VIDEO_URL = "https://1304796331.vod-qcloud.com/277548eevodsh1304796331/7a60c9331397757907901951428/OlNlILjTUYYA.mp4" // 西游记 云宫迅音
    // 备用MP4视频: "https://storage.googleapis.com/exoplayer-test-media-0/BigBuckBunny_320x180.mp4"
    
    // 当前选中的视频类型 - 默认为MP4
    val currentVideoType = mutableStateOf(VideoType.MP4)
    
    // 当前使用的视频URL（可变）- 默认为MP4
    val currentVideoUrl = mutableStateOf(MP4_VIDEO_URL)
    
    // 初始化 - 确保应用启动时使用MP4
    init {
        // 初始化时确保使用MP4格式视频
        switchVideoType(VideoType.MP4)
    }
    
    // 切换视频类型
    fun switchVideoType(type: VideoType) {
        currentVideoType.value = type
        currentVideoUrl.value = when (type) {
            VideoType.DASH -> DASH_VIDEO_URL
            VideoType.HLS -> HLS_VIDEO_URL
            VideoType.MP4 -> MP4_VIDEO_URL
        }
    }
    
    // 向后兼容的常量（为了不破坏现有代码）
    val CURRENT_VIDEO_URL: String
        get() = currentVideoUrl.value
} 